#!/bin/bash
XINFERENCE_MODEL_SRC=modelscope XINFERENCE_HOME=/xinference/xinference_cache xinference-local -H 0.0.0.0 &
while true; do
  if curl -s "http://localhost:9997" > /dev/null; then
    break
  else
    sleep 1
  fi
done

## text to audio
xinference launch --model-name CosyVoice-300M-SFT --model-uid CosyVoice-300M-SFT  --model-type audio --gpu-idx 0 --model_path /home/weights/CosyVoice-300M-SFT

## audio to text
xinference launch --model-name whisper-large-v3-turbo --model-uid whisper-large-v3-turbo --model-type audio --gpu-idx 0 --model_path /home/weights/whisper-large-v3-turbo

# xinference terminate --model-uid CosyVoice-300M-SFT 
# xinference terminate --model-uid whisper-large-v3-turbo

PID1=$!
wait $PID1
wait